import Vue from 'vue'
import axious from 'axios'
import ajax from '@/utils/req'
import 'normalize.css/normalize.css' // A modern alternative to CSS resets
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css
import '@/styles/custom/common.scss' //

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control
//引入表格组件
import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'

Vue.use(VXETable)

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

// 配置请求根路径
// axious.defaults.baseURL = 'http://127.0.0.1:8000'
axious.defaults.baseURL = 'https://api.muge.chat';
Vue.prototype.$http = ajax

// 拦截器配置
// 在request拦截器中显示进度条
axious.interceptors.request.use(config => {
  // config.headers.Authorization = sessionStorage.getItem('token')
  // 最后必须return config
  return config
})
// 在response拦截器中隐藏进度条
axious.interceptors.response.use(config => {
  // NProgress.done()
  config.data = JSON.parse(config.data)
  return config
})
//挂在请求
Vue.prototype.$http=ajax
Vue.config.productionTip = false

new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})
